package com.wsjzzcbq.qianyuan.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wsjzzcbq.qianyuan.common.bean.PageBean;
import com.wsjzzcbq.qianyuan.common.bean.R;
import com.wsjzzcbq.qianyuan.sys.bean.Icon;
import com.wsjzzcbq.qianyuan.sys.mapper.IconMapper;
import com.wsjzzcbq.qianyuan.sys.param.IconParam;
import com.wsjzzcbq.qianyuan.sys.service.IconService;
import org.springframework.stereotype.Service;

/**
 * IconServiceImpl
 *
 * @author wsjz
 * @date 2022/03/21
 */
@Service
public class IconServiceImpl extends ServiceImpl<IconMapper, Icon> implements IconService {

    @Override
    public R<PageBean<Icon>> findList(IconParam param) {
        LambdaQueryWrapper<Icon> lqw = new LambdaQueryWrapper<>();
        if (param.getType() != null) {
            lqw.eq(Icon::getType, param.getType());
        }
        IPage<Icon> iPage = this.page(new Page<>(param.getPageNum(), param.getPageSize()), lqw);

        return R.success(PageBean.create(iPage));
    }
}
